<?php 
$this->headLink(array('href' => '/cms/styles/style.css', 'rel' => "stylesheet", 'type' => "text/css"));
$this->headLink(array('href' => '/cms/styles/selectorWidgetTheme.css', 'rel' => "stylesheet", 'type' => "text/css"));

$this->headScript()
	->appendFile('/cms/scripts/dojo/dojo.js','',array('djConfig'=> 'parseOnLoad:true, isDebug:false'))
	->setAllowArbitraryAttributes(true);
$this->headScript()->appendFile('/cms/scripts/tabWidget.js');
$this->headScript()->appendFile('/cms/scripts/selectorWidget.js');
$this->headScript()->appendScript("var menu_id = '{$this->menu_id}';");
$this->headScript()->appendScript(<<<EOD
dojo.addOnLoad(function () {
		new mfTabWidget('tabsList');
		new mfSelectorsWidget('selectorBox',{defaultBoxClass:'mfSelectorWidget'});
		
		dojo.query('#editGroupsListBackTab, #editGroupsListCloseBtn')
			.onclick(function () {
					window.parent.setTimeout('Shadowbox.close()',10);
				});
				
		dojo.query('#editGroupsListSubmitBtn').onclick(
			function () {
				dojo.xhrPost({
						url: '/cms/admingroup/menu/type/save/id/'+menu_id,
						load: function(response, ioArgs) {
								if (response['ok']=='1') {
									window.parent.setTimeout('Shadowbox.close()',10);
								}
							},
						error: function (response, ioArgs){
								alert("An error occurred, with response: " + response);
								return response;
							},
						form: 'editGroupsListFm',
						handleAs:"json",
						sunc: true
					});
				
			});
	});
EOD
);
?>
<div id="adminListBox">
  <ul id="tabsList">
    <li><a href="/cms/administrator/menu/id/<?= $this->menu_id ?>">Пользователи</a></li>
    <li class="active"><a>Группы</a></li>
  </ul>
  <div class="modalContent">
    <h1>Управление доступом для групп администраторов</h1>
    <p class="stnd_font">Меню: <?= $this->name ?></p>
    <form id="editGroupsListFm">
      <p class="stnd_font"><label><input type="checkbox" value="1" name="recursive" /> Применить для всех вложенных разделов</label></p>
      <div id="selectorBox">
      <?php foreach ($this->groupsList as $admin) : ?>
        <label>
        <input name="groupid[]" type="checkbox" value="<?= $admin[0] ?>" <?= $admin[2] ? ' checked="checked"' : ''?> /><?= $admin[1] ?></label>
      <?php endforeach; ?>
      </div>
    </form>
  </div>
  <div class="modalControls">
    <div class="controllGrad"></div>
    <div class="modalControlsBox">
      <input type="button" class="okButton" value="Сохранить" id="editGroupsListSubmitBtn" />
      <input type="button" class="okButton" value="Закрыть" id="editGroupsListCloseBtn" />
    </div>
  </div>
</div>